﻿#region
/*******************************************************************************
** File Name:		    AdminGroupRightRepository.cs
** Creator:		        chao.jiang 
** EMail:               chao.jiang 
** Create date:	        
** Latest Modifier:
** Latest Modify date:
** Description:		    
** Modify History:
**
** Code Review:
**
** Version number:       1.0.0
*********************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using Phoenix.Entity;
using Phoenix.Respository;
using IBatisNet.DataMapper;
using Phoenix.Data.IBatis;
using System.Collections;

namespace Phoenix.IBatisRepository
{
    public class AdminGroupRightRepository : BaseIBatisDao,IAdminGroupRight 
    {
    
		#region  Auto Generation

        public AdminGroupRightRepository()
            : base("/Config/IBatis/86TCMap.Config")
        {

        }
        		
        public void AddAdminGroupRight(EAdminGroupRight entity)
        {
			string stmtId = "AdminGroupRightMap.InsertAdminGroupRight";
			base.SqlMapper.Insert(stmtId, entity);
        }
        
		public  EAdminGroupRight GetByAdminGroupRightID (System.Int32 adminGroupRightID)
        {
			string stmtId = "AdminGroupRightMap.SelectByAdminGroupRightID";
			return base.SqlMapper.QueryForObject<EAdminGroupRight>(stmtId, adminGroupRightID);
        }
        
        public  void DeleteByAdminGroupRightID (System.Int32 adminGroupRightID)
        {
			string stmtId = "AdminGroupRightMap.DeleteByAdminGroupRightID";
			base.SqlMapper.Update(stmtId, adminGroupRightID);
        }
        
        public  void UpdateByAdminGroupRightID (EAdminGroupRight entity)
        {
			string stmtId = "AdminGroupRightMap.UpdateByAdminGroupRightID";
			base.SqlMapper.Update(stmtId, entity);
        }


		#endregion

        public EAdminGroupRight GetByGroupIDAndRightID(int groupID, int rightID)
        {
            Hashtable ht = new Hashtable();
            ht.Add("RightID", rightID);
            ht.Add("GroupID", groupID);

            string stmtId = "AdminGroupRightMap.SelectByGroupIDAndRightID";
            return base.SqlMapper.QueryForObject<EAdminGroupRight>(stmtId, ht);
        }

        public IList<EAdminGroupRight> GetByGroupID(int groupID)
        {
            string stmtId = "AdminGroupRightMap.SelectByGroupID";
            return base.SqlMapper.QueryForList<EAdminGroupRight>(stmtId, groupID);
        }
    }
}

